highs-sys
Rust binding for the HiGHS linear programming solver. See http://highs.dev.
This repository contains the source for HiGHS itself as a submodule. You should clone it with
git clone --recursive git@github.com:rust-or/highs-sys.git
Dependencies
This library depends on libstdc++ and libgomp at runtime. In order to build, it requires cmake and a C++ compiler.
Install on debian
sudo apt-get install libstdc++6 libgomp1
(These are probably already installed on your system)
Install on MacOS
brew install libomp
HiGHS itself is built statically, so you don't need to install it separately on the target system.
Example
// This illustrates the use of Highs_call, the simple C interface to
// HiGHS. It's designed to solve the general LP problem
//
// Min c^Tx subject to L <= Ax <= U; l <= x <= u
//
// where A is a matrix with m rows and n columns
//
// The scalar n is numcol
// The scalar m is numrow
//
// The vector c is colcost
// The vector l is collower
// The vector u is colupper
// The vector L is rowlower
// The vector U is rowupper
//
// The matrix A is represented in packed column-wise form: only its
// nonzeros are stored
//
// * The number of nonzeros in A is nnz
//
// * The row indices of the nonnzeros in A are stored column-by-column
// in aindex
//
// * The values of the nonnzeros in A are stored column-by-column in
// avalue
//
// * The position in aindex/avalue of the index/value of the first
// nonzero in each column is stored in astart
//
// Note that astart[0] must be zero
//
// After a successful call to Highs_call, the primal and dual
// solution, and the simplex basis are returned as follows
//
// The vector x is colvalue
// The vector Ax is rowvalue
// The vector of dual values for the variables x is coldual
// The vector of dual values for the variables Ax is rowdual
// The basic/nonbasic status of the variables x is colbasisstatus
// The basic/nonbasic status of the variables Ax is rowbasisstatus
//
// The status of the solution obtained is modelstatus
//
// To solve maximization problems, the values in c must be negated
//
// The use of Highs_call is illustrated for the LP
//
// Min f = 2x_0 + 3x_1
// s.t. x_1 <= 6
// 10 <= x_0 + 2x_1 <= 14
// 8 <= 2x_0 + x_1
// 0 <= x_0 <= 3; 1 <= x_1
For more examples, have a look at tests
.